package com.ltmall.api.weixin.util;

import com.ltmall.api.comm.Path;

public class Constant {

    private static boolean isDebug = false;

    public static String getImageDomain() {
        if (isDebug) {
            return DEBUG_IMAGE_DOMAIN;
        } else {
            return ONLINE_IMAGE_DOMAIN;
        }
    }

    public static String getLimitQRCodeAddress(int userID) {
        if (isDebug) {
            return "{\"action_name\": \"QR_SCENE\", \"action_info\": {\"scene\": {\"scene_id\": "
                    + userID + "}}}";
        } else {
            return "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": "
                    + userID + "}}}";
        }

    }

    public static String[] getTemplateParams() {
        if (isDebug) {
            return LOCAL_TEMPLATE_PARAMS;
        }
        return ONLINE_TEMPLATE_PARAMS;
    }

    public static String getWechatMallHost() {
        if (isDebug) {
            return LOCAL_WECHAT_MALL_HOST;
        }
        return ONLINE_WECHAT_MALL_HOST;
    }

    public static String getAccessTokenKey() {
        if (isDebug) {
            return TEST_ACCESS_TOKEN_KEY;
        }
        return ONLINE_ACCESSTOKENKEY;
    }

    public static String getAccessTestTokenKey() {
        return TEST_ACCESS_TOKEN_KEY;
    }

    //TODO 这个函数写的有问题，命名也有问题
    public static String getIp() {
        if (isDebug) {
            try {
                //				localIp = "http://" + InetAddress.getLocalHost().getHostAddress().toString() + ":";
                localIp = "http://115.28.57.124:";
            } catch (Exception e) {
                localIp = "htpp://localhost:8080/";
            }
            return localIp;
        }
        return remoteIp;
    }

    public static String getResourcePort() {
        if (isDebug) {
            return localResPort;
        }
        return remoteResPort;
    }

    public static String getProjectPort() {
        if (isDebug) {
            return localProjPort;
        }
        return remoteProjPort;
    }

    //TODO 这个地方存在问题，地址不正确
    public static String getAttr() {
        if (isDebug) {
            return DEBUG_ATTR;
        } else {
            return ONLINE_ATTR;
        }
    }

    public static int getPort() {
        return PORT;
    }

    public static String getAuth() {
        if (isDebug) {
            return DEBUG_AUTH;
        } else {
            return ONLINE_AUTH;
        }
    }

    // 本地IP和端口号
    public static String localIp = null;
    public static String localResPort = "8080";                                 // 图片服务器的端口号
    public static String localProjPort = "8080";                                 // 项目服务器的端口号

    // 远程IP和端口号
    public static String remoteIp = "http://115.28.57.124:";
    public static String remoteResPort = "8080";                                 // 图片服务器的端口号
    public static String remoteProjPort = "8080";                                 // 项目服务器的端口号

    public static final String[] LOCAL_TEMPLATE_PARAMS = {
            "KgJsKqNhqdUtddRGI6quJhPHXlzQItd1IcT2ORdB0eQ",
            "HXVBHPHEpq9updlZx7CfxgZ6TxYVi0eJCc1QCUKIHR4",
            "8asCbeAAQuVX0GYc4MQrzC0_E6qi52-Wr0oqc-mqUdE",
            "aVYC6xn5RiBbwvXCn--hYsrrJsBiGyTtY8MqLlkaU7Y",
            "cH2zcBtU1UStKXNZPw9UD3VM81SwMD_k1bEoFZL6bVE",
            "NHULK8x8J-E2XJGDfTwDdaSxJUUy5vy62HqR5Bagivs",
            "RyMzfoyBTQB16ClCt3bZgRzSy16JxggtXnfBsIiHHz4",
            "012NwaXlNM2MpHO-_oU5ZBib3l1IrovXyPMbhaTQ7TA",
            "A9v4kN_JWCc_oLmALcEAvV1ZYTQeGL_f6TVPbuJsiSs",
            "GuUoVjmEkjyiV2CYMxJeTk77htFxNmsgufoY8wO9q7M"};

    public static final String[] ONLINE_TEMPLATE_PARAMS = {
            "xS6RtptBIHh3C_LA1guq-gL8xZgEkAbhb0YYWRzqXJ4",
            "yUYI2fpWj1qApJy-pwzFIVYawXiknubNyXP33h5bVIY",
            "UzPEsR5rv8kiI1kZf8oQV1Wj4pmGHjw5joE5eze7qdk",
            "4QDdGBvXnFvz4lwPRDeRADJNGE8a5N6nC1ZuT4xOVVY",
            "InxdDheD0Jz60jkHZk_twGEUhqCUiytvk77okrqnKo8",
            "Fq_CIWUnjWEx8FU5eTkNBQFuuqGQJy-1wbLCSXFiouY",
            "i0bzO137NmVM-m76TW9xtKjPL_Pe4pjt_X88dyBtPIY",
            "AuMR51iaM7QJXk2oXpx2q5ZBkdiaFzuEwY0fuBi-zio",
            "A9v4kN_JWCc_oLmALcEAvV1ZYTQeGL_f6TVPbuJsiSs",
            "GuUoVjmEkjyiV2CYMxJeTk77htFxNmsgufoY8wO9q7M"};

    public static final String LOCAL_WECHAT_MALL_HOST = "http://www.xiangweihui.com/wechatTest";

    public static final String ONLINE_WECHAT_MALL_HOST = "http://www.xiangweihui.com/wechatPay";

    public static final String TEST_ACCESS_TOKEN_KEY = "cache_wechat_access_token";

    public static final String ONLINE_ACCESSTOKENKEY = "cache_wechat_access_token_online";

    //Redis服务器IP
    private static final String ONLINE_ATTR = "115.28.57.124";
    private static final String DEBUG_ATTR = "115.28.57.124";

    //Redis的端口号
    private static final int PORT = 6379;

    //访问密码
    private static final String DEBUG_AUTH = "wbtc123";
    private static final String ONLINE_AUTH = "wbtc123";

    private static final String DEBUG_IMAGE_DOMAIN = "http://localhost:8080";
    private static final String ONLINE_IMAGE_DOMAIN = Path.domain;

}